<?php
namespace app\payment\model;

use think\Model;

/**
 * 交易
 * @property string $id
 * @property string $payer 付款人
 * @property string $payee 收款人
 * @property string $amount 金额
 * @property string $time
 * @property string $status
 */
class PaymentModel extends Model
{
    protected $table="payment";
    static $statusEnum=[
        0=>"新创建",
        1=>"已扫码",
        2=>"已支付",
        3=>"已取消",
    ];
    public function install()
    {
        $table=$this->db()->getTable();
        $sql="CREATE TABLE IF NOT EXISTS `$table` (
            `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
            `payer` int(11) NOT NULL,
            `payee` int(11) NOT NULL,
            `amount` decimal(10,2) NOT NULL,
            `time` int(11) NOT NULL,
            `status` int(11) NOT NULL
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        $this->db()->execute($sql);
    }
}